package com.skcc.cip.ngms.mail.processor;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;

import com.skcc.cip.ngms.dto.response.jaxb.mailpush.Data;
import com.skcc.cip.ngms.dto.response.jaxb.mailpush.DataList;
import com.skcc.cip.ngms.dto.response.jaxb.mailpush.Interface;
import com.skcc.cip.ngms.dto.response.jaxb.mailpush.Message;
import com.skcc.cip.ngms.dto.response.jaxb.mailpush.ObjectFactory;

public class MailNotificationPush implements Processor{

	public void process(Exchange exchange) throws Exception {
		//mslm에 요청시
		ObjectFactory factory = new ObjectFactory();
		Interface inter = factory.createInterface();
		
		Message message =  factory.createMessage();
		message.setAction(factory.createAction("SYNC").getValue());
		message.setKey(factory.createAction("oceanpie").getValue());
		
		DataList dataList = factory.createDataList();
		Data dataType = new Data();
		dataType.setKey("type");
		dataType.setValue("MAIL");
		dataList.getData().add(dataType);
		
		Data dataCount = new Data();
		dataCount.setKey("unread");
		dataCount.setValue("1");
		dataList.getData().add(dataCount);
		
		message.setDataList(dataList);
		
		inter.setMessage(message);
		
		exchange.getIn().setBody(inter);
		
	}
	
}
